//
//  TestViewController.swift
//  Swift表情键盘
//
//  Created by 王冲 on 2018/1/20.
//  Copyright © 2018年 希爱欧科技有限公司. All rights reserved.
//

import UIKit

class TestViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

       
        self.view.backgroundColor = UIColor.JKRandomColor()
        
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "跳转", style: UIBarButtonItemStyle.plain, target: self, action: #selector(TestViewController.hha))
        
        self.view.addSubview(label)
        
        let str = "京八件[心]，又少了8盒？饽饽匣子，又提走6盒？扒仔鸡，是谁买走了我看上的那2只？我最爱的酱牛肉，你还能不能等等我。来北京稻香村[偷笑]抢购年货，是年前最正经的事[嘻嘻]，再不入手，过年都不好意思出门啦[玫瑰]"
        
        let attributedString:NSAttributedString = JKEmoticonAttributedString().backwards(str: str, font: 28)!
        label.attributedText = attributedString
        
        let size: CGSize = JKwideHighSize().attributedStringSize(aString: attributedString, width: JKscreenW, height: CGFloat(MAXFLOAT), font: 28)
        label.height = size.height

    }
    
    
    @objc func hha() {
        
        print("哈哈")
        navigationController?.pushViewController(TestViewController2(), animated: true)
    }

    
    lazy var label: UILabel = {
        
        let lab = UILabel(frame: CGRect(x: 0, y: 100, width: JKscreenW, height: 0))
        lab.font = UIFont.systemFont(ofSize: 28)
        lab.numberOfLines = 0
        lab.backgroundColor = UIColor.red
        return lab
        
    }()
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
